<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : products.xsl
    Created on : November 25, 2012, 7:36 PM
    Author     : kenisk
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
        <thead>
            <th>
                Product Name
            </th>
            <th>
                Price
            </th>
            <th>
                Stock
            </th>
            <th>
                Unit
            </th>
            <th>
                Action
            </th>
        </thead>
        <tbody>
            <xsl:for-each select="Products/Product">
                <tr>
                    <form action="ProductController" method="Post">
                        <xsl:attribute name="id">
                                <xsl:value-of select="ProductID"/>
                        </xsl:attribute>
                        <td>
                            <xsl:value-of select="ProductName"/>
                        </td>
                        <td>
                            <input type="text" onkeydown="return validateDigits(event)" style="text-align: right;" pattern="[\d]*[.]?[\d]?[\d]?" >
                                <xsl:attribute name="value">
                                    <xsl:value-of select="Price"/>
                                </xsl:attribute>
                                <xsl:attribute name="name">
                                    <xsl:value-of select="'Price'"/>
                                </xsl:attribute>
                            </input>
                        </td>
                        <td>
                            <input type="text" onkeydown="return validateDigits(event)" style="text-align: right;">
                                <xsl:attribute name="value">
                                    <xsl:value-of select="Stock"/>
                                </xsl:attribute>
                                <xsl:attribute name="name">
                                    <xsl:value-of select="'Stock'"/>
                                </xsl:attribute>
                            </input>
                        </td>
                        <td>
                            <xsl:value-of select="Unit"/>
                        </td>
                        <td>
                            <input type="hidden">
                                <xsl:attribute name="value">
                                    <xsl:value-of select="ProductID"/>
                                </xsl:attribute>
                                <xsl:attribute name="name">
                                    <xsl:value-of select="'ProductID'"/>
                                </xsl:attribute>
                            </input>
                            <input type="submit">
                                <xsl:attribute name="value">
                                    <xsl:value-of select="'Edit'"/>
                                </xsl:attribute>
                                <xsl:attribute name="name">
                                    <xsl:value-of select="'Action'"/>
                                </xsl:attribute>
                            </input>
                        </td>
                    </form>
                </tr>
            </xsl:for-each>
        </tbody>
    </xsl:template>
</xsl:stylesheet>
